In addition to performing its primary function, IDL_StoreScalar() and IDL_StoreScalarZero() have two very useful side effects:
Often, a system routine accepts an input argument that will have a new value assigned to it before the routine returns to its caller, and the initial value of that argument is of no interest to the routine. Storing a scalar value into such an argument at the start of the routine will automatically check it for storability and free unnecessary dynamic memory. In one easy operation, the required error checking is done, and you’ve improved the dynamic memory behavior of the IDL system by minimizing dynamic memory fragmentation. For example:
IDL_StoreScalarZero(&v, IDL_TYP_LONG);
Error handling is discussed further in IDL Internals: Error Handling.